package org.lcx.pipeline.example.submitorder;

import org.lcx.pipeline.Processor;
import org.lcx.pipeline.bean.PipelineExeption;
import org.lcx.pipeline.bean.PipelineResult;

import java.util.Map;
import java.util.Random;

/**
 * 公交车
 */
public class StockProcessor implements Processor {

    @Override
    public int runProcess(Object params, PipelineResult result) throws PipelineExeption {
        int resultint = 0;

        StringBuffer msgFormat = new StringBuffer("库存逻辑");
        Random random = new Random();
        int randomNum = random.nextInt(10);
        msgFormat.append("-->开始处理，处理的结果:" + randomNum);

        Map paramMap = (Map) params;
        resultint = (int) paramMap.get("stockNext");


        paramMap.put("stockResult", randomNum);

        System.out.println(msgFormat.toString());
        return resultint;
    }

}
